<?php

/*
 * 用户自定义函数库，框架启动时会自动加载
 */

function msgbox($msg, $url = '', $style = 'info', $time = 2, $backstep = 1) {
    $params = array(
        'style' => $style,
        'msg' => $msg,
        'url' => $url,
        'time' => $time,
        'backstep' => $backstep,
    );
    die(Hmvc::load('Msgbox', 'index', $params));
}

function succ($msg = '操作成功', $url = '', $backstep = 1) {
    if (!$msg) {
        $msg = '操作成功';
    }
    msgbox($msg, $url, 'success', 2, $backstep);
}

function fail($msg = '操作失败', $url = '', $backstep = 1) {
    if (!$msg) {
        $msg = '操作失败';
    }
    msgbox($msg, $url, 'warning', 2, $backstep);
}